from flask import Flask, redirect, url_for, request, render_template

app = Flask(__name__)


@app.route("/")
def index():
    return render_template("login.html")


@app.route("/success/<name>")
def success(name):
    return "welcome %s" % name


@app.route("/login", methods=["POST", "GET"])
def login():
    if request.method == "POST":
        print(1)
        user = request.form["user_name"]
        return redirect(url_for("success", name=user))
    else:
        print(2)
        user = request.args.get("user_name")
        return redirect(url_for("success", name=user))


if __name__ == "__main__":
    any_ip = "0.0.0.0"
    http_port = 8088
    app.run(any_ip,http_port)
